package org.zoomdev.zoom.dao.adapters.parameter;

import org.zoomdev.zoom.dao.adapters.ParameterAdapter;

import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.time.LocalDate;

// Java 8 LocalDate类型适配器
public class LocalDateParameterAdapter implements ParameterAdapter<LocalDate> {


    @Override
    public void setNonnullParameter(PreparedStatement ps, int index, LocalDate data) throws SQLException {
        ps.setDate(index, Date.valueOf(data));
    }
}
